var Mock = require('mockjs')
// 设置4秒后再响应
Mock.setup({ timeout: 400 })
// Mock响应模板
Mock.mock('/manager/signin?user=root', {
  'name': '管理端',
  'id': `2c9180895e172348015e1740805d000d`,
  'menus': [{
    id: '2c9180895e13261e015e13469b7e0000',
    name: '平台-角色管理',
    parent_id: null,
    route: 'roles',
    summary: null
  }, {
    id: '2c9180895e13261e015e1346d40a0001',
    name: '平台-账户管理',
    parent_id: null,
    route: 'accounts',
    summary: null
  }],
  'resources': [
    {id: '2c9180895e172348015e1740805d000d',
      method: 'GET',
      name: '账号-获取',
      summary: null,
      url: '/accounts'
    },
    {id: '4028811a5e1820d9015e1824acf20000',
      name: '获取权限',
      summary: null,
      url: '/signin',
      method: 'GET'
    },
    {
      id: '12333',
      name: '权限测试',
      summary: null,
      url: '/noAccess',
      method: 'GET'
    }
  ]
})

Mock.mock('/manager/signin?user=client', {
  'name': '客户端',
  'id': `2c9180895e172348015e188b362c0027`,
  'menus': [{
    id: '2c9180895e172348015e1857eb460025',
    name: '商品管理',
    parent_id: null,
    route: 'goods',
    summary: null
  }, {
    id: '2c9180895e172348015e18586a980026',
    name: '商品信息',
    parent_id: '2c9180895e172348015e1857eb460025',
    route: 'list',
    summary: null
  }],
  'resources': [
    {id: 'cba62955646c4a489e2ca1442c786270',
      method: 'GET',
      name: '商品-查询',
      summary: null,
      url: '/medications'
    },
    {id: '4028811a5e1820d9015e1824acf20000',
      method: 'GET',
      name: '获取权限',
      summary: null,
      url: '/signin'
    }
  ]
})

// 模拟权限请求
Mock.mock('/manager/noAccess?access=1', {
  'hello': 'world'
})
